package org.eichar.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class LanguageTutor implements EntryPoint {

    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {

        I18N i18N = new I18N();
        WidgetFactory widgetFactory = new WidgetFactoryImpl();

        TabPanel tabPanel = createTabPanel(i18N, widgetFactory);

        RootPanel.get().add(tabPanel);
    }

    private TabPanel createTabPanel(I18N i18N, WidgetFactory widgetFactory) {
        LanguageConstants constants = i18N.getConstants();
        TabPanel tabPanel = widgetFactory.createTabPanel();

        tabPanel.setSize("100%", "100%"); //$NON-NLS-1$//$NON-NLS-2$

        Quiz quiz = new Quiz(new DataAccessImpl(i18N, widgetFactory), i18N);
        tabPanel.add(quiz.getWidget(), constants.quizTab());

        DataEntry dataEntry = new DataEntry(i18N, widgetFactory);
        tabPanel.add(dataEntry.getWidget(), constants.dataEntryTab());

        Label label3 = widgetFactory.createLabel(constants.notImplemented());
        label3.setSize("100%", "100%");//$NON-NLS-1$//$NON-NLS-2$

        tabPanel.add(label3, constants.viewAllTab());

        tabPanel.selectTab(1);
        return tabPanel;
    }
}
